#ifndef DSPSIMULATOR_MEMORYMANAGEUNIT_H
#define DSPSIMULATOR_MEMORYMANAGEUNIT_H

#include <memory>
#include <simulator/type/type.h>
#include <simulator/memory/memory.h>

class MMU {
private:
    u64 m_entry;                        // 程序入口地址
    std::shared_ptr<Memory> m_memory;   // 内存
public:
    MMU() : m_memory(std::make_shared<Memory>()), m_entry(0) {};

    MMU(const MMU &mmu) {
        m_entry = mmu.m_entry;
        m_memory = std::make_shared<Memory>(*mmu.m_memory);
    }

    ~MMU() = default;

    std::shared_ptr<Memory> getMemory() { return m_memory; }

    u64 getEntryAddress() const { return m_entry; }

    void setEntryAddress(u64 entry) { m_entry = entry; }
};

#endif //DSPSIMULATOR_MEMORYMANAGEUNIT_H
